from django.urls import path, include, re_path
from rest_framework.routers import DefaultRouter

from . import views


app_name = "s"
# Create a router and register our viewsets with it.
router = DefaultRouter(trailing_slash=False)

router.register(r'list', views.ShareDirViewSet, basename='list')
router.register(r'sd', views.ShareDownloadViewSet, basename='download')
router.register(r'', views.ObsViewSet, basename='obs')


urlpatterns = [
    re_path('share/(?P<share_obspwd_base>.+)', views.ShareObjPasswordView.as_view(), name='share-obspwd'),
    re_path(r'(?P<share_base>.+)/$', views.ShareView.as_view(), name='share-view'),
    path('', include(router.urls)),     # The API URLs are now determined automatically by the router.

]
